_global_dict: dict | None = None

def _init_values():
    global _global_dict
    _global_dict = {}


# 初始化全局变量记录
_init_values()


def set_value(key, value):
    # 定义一个全局变量
    _global_dict[key] = value


def get_value(key):
    # 获得一个全局变量，不存在则提示读取对应变量失败
    try:
        return _global_dict[key]
    except KeyError:
        # print('读取'+key+'失败\r\n')
        return None

class Values:
    def __getattr__(self, item):
        return get_value(item)
    def __setattr__(self, key, value):
        set_value(key, value)

v = Values()